xen.git
14 years agox86 cpu: Fix bug: unify cpu_dev attr as __cpuinitdata
Liu, Jinsong [Fri, 8 Jul 2011 07:30:41 +0000 (08:30 +0100)]
x86 cpu: Fix bug: unify cpu_dev attr as __cpuinitdata

Currently different x86 cpu define different attr for cpu_dev.
Some cpu define as __initdata, this would be risk under cpu hotplug.
This patch fix the bug, unify them as __cpuinitdata, as what AMD cpu
define now.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
               Shan, Haitao <haitao.shan@intel.com>

14 years agolibxl: fix incorrect return of ERROR_INVAL from disk_try_backend
Ian Jackson [Thu, 7 Jul 2011 11:35:05 +0000 (12:35 +0100)]
libxl: fix incorrect return of ERROR_INVAL from disk_try_backend

disk_try_backend is supposed to return 0 or the disk backend format.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: sane disk backend selection and validation
Ian Jackson [Wed, 6 Jul 2011 17:26:49 +0000 (18:26 +0100)]
libxl: sane disk backend selection and validation

Introduce a new function libxl__device_disk_set_backend which
does some sanity checks and determines which backend ought to be used.

If the caller specifies LIBXL_DISK_BACKEND_UNKNOWN (which has the
value 0), it tries PHY, TAP and QDISK in that order.  Otherwise it
tries only the specified value.

libxl__device_disk_set_backend (and its helper function
disk_try_backend) inherit the role (and small amounts of the code)
from validate_virtual_disk.  This is called during do_domain_create
and also from libxl_disk_device_add (for the benefit of hotplug
devices).

It also now takes over the role of the scattered fragments of backend
selection found in libxl_device_disk_add,
libxl_device_disk_local_attach and libxl__need_xenpv_qemu.  These
latter functions now simply do the job for the backend they find has
already been specified and checked.

The restrictions on the capabilities of each backend, as expressed in
disk_try_backend (and to an extent in libxl_device_disk_local_attach)
are intended to be identical to the previous arrangements.

In 23618:3173b68c8a94 combined with 23622:160f7f39841b,
23623:c7180c353eb2, "xl" effectively became much more likely to select
TAP as the backend.  With this change to libxl the default backend
selected by the libxl__device_disk_set_backend is intended to once
again to be PHY where possible.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>
14 years agolibxl: testenum.c depends on libxl.h
Olaf Hering [Wed, 6 Jul 2011 15:32:16 +0000 (16:32 +0100)]
libxl: testenum.c depends on libxl.h

testenum.c may fail to compile if libxl.h dependencies are not yet met.

In file included from testenum.c:3:
libxl.h:199:26: error: _libxl_types.h: No such file or directory
In file included from testenum.c:3:
libxl.h:203: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
....

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agox86: Couple of small cleanups after cpuid faulting patch.
Keir Fraser [Mon, 4 Jul 2011 06:57:32 +0000 (07:57 +0100)]
x86: Couple of small cleanups after cpuid faulting patch.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86: Remove redundant cpuid-faulting-related BUG_ON I added.
Keir Fraser [Sat, 2 Jul 2011 08:08:27 +0000 (09:08 +0100)]
x86: Remove redundant cpuid-faulting-related BUG_ON I added.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86: cpuid faulting feature enable
Liu, Jinsong [Fri, 1 Jul 2011 21:28:53 +0000 (22:28 +0100)]
x86: cpuid faulting feature enable

Latest Intel processor add cpuid faulting feature. This patch is used
to support cpuid faulting in Xen.  Like cpuid spoofing, cpuid faulting
mainly used to support live migration. When cpuid faulting enabled,
cpuid instruction runs at cpl>0 will produce GP, vmm then emulate
execution of the cpuid instruction. Hence will appear to guest
software the value chosen by the vmm.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
14 years agonestedsvm: fix handling of invalid virtual vmcb
Christoph Egger [Fri, 1 Jul 2011 19:48:00 +0000 (20:48 +0100)]
nestedsvm: fix handling of invalid virtual vmcb

When the l1 guest sets up an invalid vmcb then inject VMEXIT(#INVALID)
rather having the host sitting in an endless loop of injecting #UD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
14 years agox86: remove the domain parameter from the guest EOI functions.
Jan Beulich [Fri, 1 Jul 2011 19:46:54 +0000 (20:46 +0100)]
x86: remove the domain parameter from the guest EOI functions.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: make domain_spin_lock_irq_desc() a wrapper of pirq_spin_lock_irq_desc()
Jan Beulich [Fri, 1 Jul 2011 19:45:21 +0000 (20:45 +0100)]
x86: make domain_spin_lock_irq_desc() a wrapper of pirq_spin_lock_irq_desc()

...and drop the now unused struct domain * parameter of the latter.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: remove unnecessary ALIGN directives
Jan Beulich [Fri, 1 Jul 2011 19:44:50 +0000 (20:44 +0100)]
x86: remove unnecessary ALIGN directives

ENTRY() already includes an ALIGN.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86-64/mmcfg: fix pci_mmcfg_arch_free()
Jan Beulich [Fri, 1 Jul 2011 19:44:21 +0000 (20:44 +0100)]
x86-64/mmcfg: fix pci_mmcfg_arch_free()

While only used on error paths so far, it should still actually do
something (which iounmap(), being an empty stub, doesn't).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: streamline page fault path
Jan Beulich [Fri, 1 Jul 2011 19:43:55 +0000 (20:43 +0100)]
x86: streamline page fault path

#PF is, in all "normal" usage models, the only potentially high
frequency (and hence performance sensitive) exception. Thus make it
the fall-through case into handle_exception (rather than
divide_error for x86-32 and not having one at all for x86-64).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: adjust pirq_spin_lock_irq_desc()
Jan Beulich [Fri, 1 Jul 2011 19:43:02 +0000 (20:43 +0100)]
x86: adjust pirq_spin_lock_irq_desc()

Remove unnecessary/bogus assertions and add retry loop matching
domain_spin_lock_irq_desc().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86/EFI: adjust installation logic
Jan Beulich [Fri, 1 Jul 2011 19:42:22 +0000 (20:42 +0100)]
x86/EFI: adjust installation logic

We should always install xen.efi into /usr/lib64/efi/; installation
into /boot/efi/efi/$(EFI_VENDOR) remains dependent upon specifying
EFI_VENDOR.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86/EFI: fix interrupt and fault handling during runtime services calls
Jan Beulich [Fri, 1 Jul 2011 19:41:43 +0000 (20:41 +0100)]
x86/EFI: fix interrupt and fault handling during runtime services calls

The missing piece was the setting up of an accessible GDT prior to
switching page tables (and reverting to the original setting after
having established the normal page tables again afterwards).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agoxentrace: Allow tracing to be enabled at boot
George Dunlap [Fri, 1 Jul 2011 19:31:18 +0000 (20:31 +0100)]
xentrace: Allow tracing to be enabled at boot

Add a "tevt_mask" parameter to the xen command-line, allowing
trace records to be gathered early in boot.  They will be placed
into the trace buffers, and read when the user runs "xentrace".

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
14 years agoxentrace: Add tracing for IRQ-related events
George Dunlap [Fri, 1 Jul 2011 19:29:35 +0000 (20:29 +0100)]
xentrace: Add tracing for IRQ-related events

Add tracing for various IRQ-related events.  Also, move
the exiting TRC_TRACE_IRQ from the "generic" class into the
new TRC_HW_IRQ sub-class.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
14 years agoxentrace: Make a new hardware-related trace class
George Dunlap [Fri, 1 Jul 2011 19:22:38 +0000 (20:22 +0100)]
xentrace: Make a new hardware-related trace class

Power management seems a very narrow focus for its own class, of
which we have a limited number due to the layout of the trace
records.  Make a hardware-event trace class, and move power management
events into a subclass of those.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
14 years agox86/mm: fix the non-debug build
Tim Deegan [Thu, 30 Jun 2011 10:01:04 +0000 (11:01 +0100)]
x86/mm: fix the non-debug build

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agoNested p2m: use a linked list for LRU np2m selection.
Tim Deegan [Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)]
Nested p2m: use a linked list for LRU np2m selection.

Because the flush-all-np2ms op doesn't take the np2m lock any more
we can't reorder the p2ms in the array that it will walk.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agox86/p2m: Add p2m_change_type_range() operation
Tim Deegan [Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)]
x86/p2m: Add p2m_change_type_range() operation
that defers the nested-p2m flush until the entire batch has been updated.
Use it in the HAP log-dirty operations for tracking VRAM changes.
This should avoid a lot of unpleasant IPI storms as the log-dirty code
on one CPU repeatedly shoots down the nested p2m of another CPU.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agoNested p2m: rework locking around nested-p2m flushes and updates.
Tim Deegan [Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)]
Nested p2m: rework locking around nested-p2m flushes and updates.

The nestedp2m_lock now only covers the mapping from nested-cr3 to
nested-p2m; the tables themselves may be updated or flushed using only
the relevant p2m lock.

This means that the nested-p2m lock is only taken on one path, and
always before any p2m locks.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
14 years agoNested p2m: flush only one p2m table when reallocating.
Tim Deegan [Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)]
Nested p2m: flush only one p2m table when reallocating.
It's unhelpful to flush all of them when we only need one.

Reported-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
14 years agoNested p2m: clarify logic in p2m_get_nestedp2m()
Tim Deegan [Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)]
Nested p2m: clarify logic in p2m_get_nestedp2m()

This just makes the behaviour of this function a bit more explicit.  It
may be that it also needs to be changed. :)

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
14 years agoNested p2m: remove bogus check of CR3 value.
Tim Deegan [Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)]
Nested p2m: remove bogus check of CR3 value.

0 is a valid CR3 value; CR3_EADDR isn't but there's nothing stopping a
guest from putting it in its VMCB.  The special case was broken anyway
since AFAICT "p2m->cr3" is a nester-cr3 (i.e. p2m-table) value and
guest_cr[3] is an actual-cr3 (pagetable) value.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
14 years agoNested p2m: implement "flush" as a first-class action
Tim Deegan [Thu, 30 Jun 2011 09:26:54 +0000 (10:26 +0100)]
Nested p2m: implement "flush" as a first-class action
rather than using the teardown and init functions.
This makes the locking clearer and avoids an expensive scan of all
pfns that's only needed for non-nested p2ms.  It also moves the
tlb flush into the proper place in the flush logic, avoiding a
possible race against other CPUs.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
14 years agolibxc: Squash xc_e820.h (and delete) into xenctrl.h
Konrad Rzeszutek Wilk [Tue, 28 Jun 2011 17:15:44 +0000 (18:15 +0100)]
libxc: Squash xc_e820.h (and delete) into xenctrl.h

.. as there is no need to keep that internal header file anymore.
We export two functions xc_domain_[set|get]_memory_map which
depend on the 'struct e820entry' defined in 'xc_e820.h'.

We move the contents of the 'xc_e820.h' to the 'xenctrl.h' fixing
compiler errors when applications outside the Xen tree are trying
to compile against the libraries.

Tested-by: Daniel Castro <evil.dani@gmail.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agox86_32: Fix buil dafter EFI MPS patch.
Keir Fraser [Tue, 28 Jun 2011 13:45:36 +0000 (14:45 +0100)]
x86_32: Fix buil dafter EFI MPS patch.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agoQEMU_TAG update
Ian Jackson [Tue, 28 Jun 2011 13:01:53 +0000 (14:01 +0100)]
QEMU_TAG update

14 years agoxend: NetBSD portability fix for LVM raw volume names
Roger Pau Monne [Tue, 28 Jun 2011 12:56:53 +0000 (13:56 +0100)]
xend: NetBSD portability fix for LVM raw volume names

Xen 4.1.1 was incorrectly passing /dev/rmapper/vg-lvname to pygrub
(notice the r in front of mapper), when it should pass
/dev/mapper/rvg-lvname (add the r to the last file) when using NetBSD.
I've patched it to work correctly. I'm attaching a unified diff with
the patch made against Xen 4.1.1 (it's a really simple modification).

From: Roger Pau Monne <roger.pau@entel.upc.edu>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxl: new "check-xl-disk-parse" test script for disk parser
Ian Jackson [Tue, 28 Jun 2011 11:19:17 +0000 (12:19 +0100)]
xl: new "check-xl-disk-parse" test script for disk parser

This runs "xl -N block-attach 0 <some strings>" for various sets of
strings and checks that the output is as expected.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agoxl: xl block-attach -N (dry run) option
Ian Jackson [Tue, 28 Jun 2011 11:19:17 +0000 (12:19 +0100)]
xl: xl block-attach -N (dry run) option

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agoxl: implement -N (dry run) global option for create and cpupool-create
Ian Jackson [Tue, 28 Jun 2011 11:19:16 +0000 (12:19 +0100)]
xl: implement -N (dry run) global option for create and cpupool-create

These subcommands already had "-n" dry run options.  Make -N do the
same thing, and deprecate those -n options.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agoxl: new global -N option for dry run
Ian Jackson [Tue, 28 Jun 2011 11:19:15 +0000 (12:19 +0100)]
xl: new global -N option for dry run

This sets a global dryrun_only variable, which individual commands are
expected to honour.  To avoid accidents, we introduce a new can_dryrun
member in the command table, which is initially set to 0 for each
command.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agolibxl: disks: allow specification of "backendtype=phy|tap|qdisk"
Ian Jackson [Tue, 28 Jun 2011 11:19:15 +0000 (12:19 +0100)]
libxl: disks: allow specification of "backendtype=phy|tap|qdisk"

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agoxl: disks: replace block-attach disk config parser with call to xlu_parse_disk
Ian Jackson [Tue, 28 Jun 2011 11:19:14 +0000 (12:19 +0100)]
xl: disks: replace block-attach disk config parser with call to xlu_parse_disk

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agoxl: disks: replace config file disk spec parser with call to xlu_disk_parse
Ian Jackson [Tue, 28 Jun 2011 11:19:13 +0000 (12:19 +0100)]
xl: disks: replace config file disk spec parser with call to xlu_disk_parse

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agodocs: update xl-disk-configuration.txt to describe new syntax
Ian Jackson [Tue, 28 Jun 2011 11:19:13 +0000 (12:19 +0100)]
docs: update xl-disk-configuration.txt to describe new syntax

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agolibxl: disks: commit libxlu_disk_l.[ch] flex output
Ian Jackson [Tue, 28 Jun 2011 11:19:12 +0000 (12:19 +0100)]
libxl: disks: commit libxlu_disk_l.[ch] flex output

Commit the flex output into revision control, for the benefit of those
without flex or with only very old flex.  This change is split into a
separate patch for ease of review.  Generated with flex 2.5.35-6 on
Debian lenny i386, by running "make" in the libxl directory.  No
manual changes in this commit.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agolibxl: disks: new xlu_disk_parse function
Ian Jackson [Tue, 28 Jun 2011 11:19:11 +0000 (12:19 +0100)]
libxl: disks: new xlu_disk_parse function

Introduce new flex/regexp-based parser for disk configuration strings.
Callers will be updated in following patches.

The existing xm command line syntax for block-attach expects multiple
arguments containing different parameters for different parts of the
disk specification, so we supply a parser function which can take
multiple strings and scan them in sequence.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agolibxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work
Ian Jackson [Tue, 28 Jun 2011 11:19:10 +0000 (12:19 +0100)]
libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work

libxl callers should not be required to specify the backend if they
don't want to.  So LIBXL_DISK_BACKEND_UNKNOWN should instruct libxl to
choose the backend for itself.

For now, we do this by simply treating it the same as BACKEND_TAP,
which itself falls back to other methods.

More thorough fixes for the disk handling will follow.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agohgignore: Add EFI-related auto-generated files.
Keir Fraser [Tue, 28 Jun 2011 08:26:24 +0000 (09:26 +0100)]
hgignore: Add EFI-related auto-generated files.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86-64: EFI MPS support
Jan Beulich [Tue, 28 Jun 2011 08:21:28 +0000 (09:21 +0100)]
x86-64: EFI MPS support

It's not clear this is needed - Linux doesn't use the MPS table even
if available, and no system having one was seen so far.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86-64: EFI runtime code
Jan Beulich [Tue, 28 Jun 2011 08:20:49 +0000 (09:20 +0100)]
x86-64: EFI runtime code

This allows Dom0 access to all suitable EFI runtime services. The
actual calls into EFI are done in "physical" mode, as entering virtual
mode has been determined to be incompatible with kexec (EFI's
SetVirtualAddressMap() can be called only once, and hence the
secondary kernel can't establish its mappings). ("Physical" mode here
being quoted because this is a mode with paging enabled [otherwise
64-bit mode wouldn't work] but all mappings being 1:1.)

Open issue (not preventing this from being committed imo):

Page (and perhaps other) faults occuring while calling runtime
functions in the context of a hypercall don't get handled correctly
(they don't even seem to reach do_page_fault()). I'm intending to
investigate this further.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86-64: EFI boot code
Jan Beulich [Tue, 28 Jun 2011 08:19:35 +0000 (09:19 +0100)]
x86-64: EFI boot code

Besides introducing the relevant code paralleling parts of what is
under xen/arch/x86/boot/, this adjusts the build logic so that with a
single compilation two images (gzip-compressed ELF and EFI
application)
can get created. The EFI part of this depends on a new enough compiler
(supposedly gcc 4.4.x and above, but so far only tested to work with
4.5.x) and a properly configured linker (must support the i386pep
emulation). If either functionality is found to not be available, the
EFI part of the build will simply be skipped.

The patch adds all code to allow Xen and the (accordingly enabled)
Dom0  kernel to boot, but doesn't allow Dom0 to make use of EFI
runtime calls (this will be the subject of the next patch).

Parts of the code were lifted from an earlier never published OS
project of ours - whether respective license information needs to be
added to the respective source file is unclear to me (I was told
internally that adding a GPLv2 license header can be done if needed by
the community).

Open issues (not preventing this from being committed imo):

The trampoline allocation and initialization isn't really nice. This
is due to the trampoline needing to be placed at a fixed address, and
hence making the trampoline relocatable would seem desirable here (as
well as for BIOS-based booting, where the trampoline location needed
to be adjusted a number of time already in the past, due to it
colliding with firmware data).
By excluding mem.S, edd.S, and video.S from copied trampoline (i.e.
moving up wakeup.S? and making sure none of the symbols are used from
EFI code), the effective trampoline size could at least be reduced.

Should the mappings of [__XEN_VIRT_START, mbi.mem_upper) and
[_end, __XEN_VIRT_START+BOOTSTRAP_MAP_BASE) be destroyed, despite
non-EFI code also keeping them?

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86-64: EFI header files
Jan Beulich [Tue, 28 Jun 2011 08:17:50 +0000 (09:17 +0100)]
x86-64: EFI header files

Taken from gnu-efi-3.0k (slightly edited).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: fix boot-time watchdog test.
Tim Deegan [Tue, 28 Jun 2011 08:16:13 +0000 (09:16 +0100)]
x86: fix boot-time watchdog test.

Since the perf counter that the LAPIC NMI watchdog uses only
runs while the core isn't halted, and all APs are idle at
this point in the boot process, it's possible that remote
CPUs won't see any NMIs during the 10-tick waiting period.
Force all CPUs to busy-wait so we know the timers are running.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agox86: AMD core-pair topology detection code
Wei Huang [Tue, 28 Jun 2011 08:13:53 +0000 (09:13 +0100)]
x86: AMD core-pair topology detection code

This patch is to support core-pair topology introduced by AMD CPUs,
which introduces a new concept of [core, compute unit]. There is a new
feature bit for topology extension in CPUID:0x80000001. Also a new
CPUID 0x8000001E is introduced for CPU topology enumeration. This
patch collects the sibling information from the new CPUID and will be
stored in the sibling map in Xen hypervisor.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agox86: consolidate cpu_core_id and phys_proc_id into cpuinfo_x86 struct
Wei Huang [Tue, 28 Jun 2011 08:13:31 +0000 (09:13 +0100)]
x86: consolidate cpu_core_id and phys_proc_id into cpuinfo_x86 struct

This patch moves cpu_core_id and phys_proc_id into cpuinfo_x86
structure. This is similar to upstream Linux kernel's approach.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agoxen/xsm/flask: Fix flask_tbufcontrol hook
James Carter [Tue, 28 Jun 2011 08:11:04 +0000 (09:11 +0100)]
xen/xsm/flask: Fix flask_tbufcontrol hook

The flask_tbufcontrol hook currently calls domain_has_xen with the
second argument being a class (SECCLASS_XEN) instead of a permission.
This patch fixes the hook so that it passes the XEN__TBUFCONTROL
permission instead.

Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
14 years agoxen/xsm: Add missing dummy operation
James Carter [Tue, 28 Jun 2011 08:10:43 +0000 (09:10 +0100)]
xen/xsm: Add missing dummy operation

This patch adds a dummy op for the xsm_vcpuextstate operation.

Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
14 years agolibxl: Do not SEGV when no 'removable' disk parameter in xenstore
Marek Marczykowski [Mon, 27 Jun 2011 16:37:12 +0000 (17:37 +0100)]
libxl: Do not SEGV when no 'removable' disk parameter in xenstore

Just assume disk as not removable when no 'removable' paremeter

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxen.lowlevel.xl: Return None on empty domain name
Marek Marczykowski [Mon, 27 Jun 2011 16:34:01 +0000 (17:34 +0100)]
xen.lowlevel.xl: Return None on empty domain name

Previously PyString_FromString(NULL) was called, which caused assertion
failure.

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: Remove frontend and backend devices from xenstore after destroy
Marek Marczykowski [Mon, 27 Jun 2011 16:28:52 +0000 (17:28 +0100)]
libxl: Remove frontend and backend devices from xenstore after destroy

Cleanup frontend and backend devices from xenstore for all dev types - not only
disks. Because backend cleanup moved to libxl__device_destroy,
libxl__devices_destroy is somehow simpler.

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: Accept disk name in libxl_devid_to_device_disk
Marek Marczykowski [Mon, 27 Jun 2011 16:27:08 +0000 (17:27 +0100)]
libxl: Accept disk name in libxl_devid_to_device_disk

Accept disk name in xl block-detach.

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: Allocate memory for strings in libxl_device_disk
Marek Marczykowski [Mon, 27 Jun 2011 16:24:50 +0000 (17:24 +0100)]
libxl: Allocate memory for strings in libxl_device_disk

Memory for strings in libxl_device_disk must be allocated from outside of
libxl__gc to not be freed at the end of function (by libxl__free_all).

Fixes xl block-detach

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxl: Use macros for param parsing in network-attach
Marek Marczykowski [Mon, 27 Jun 2011 16:20:55 +0000 (17:20 +0100)]
xl: Use macros for param parsing in network-attach

'script=' length was wrong... Replaced calls to strncmp("param", *argv,
explicit sizeof("param")) with macro and helper function to extract parameter
value. Also introduce replace_string function to simplify code.

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools: Introduce XEN_RUN_DIR path.
Anthony PERARD [Mon, 27 Jun 2011 16:07:35 +0000 (17:07 +0100)]
tools: Introduce XEN_RUN_DIR path.

This patch also add libxl_run_dir_path() function in libxl.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoremus: handle exceptions while installing/unstalling net buffer
Signed-off-by: Shriram Rajagopalan [Mon, 27 Jun 2011 14:18:38 +0000 (15:18 +0100)]
remus: handle exceptions while installing/unstalling net buffer

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools: fix build after recent xenpaging changes
Tim Deegan [Mon, 27 Jun 2011 13:48:57 +0000 (14:48 +0100)]
tools: fix build after recent xenpaging changes

xenpaging now uses pthreads, so must link appropriately.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoMerge
Ian Jackson [Thu, 23 Jun 2011 17:34:55 +0000 (18:34 +0100)]
Merge

14 years agox86: show page walk also for early page faults
Jan Beulich [Thu, 23 Jun 2011 10:35:55 +0000 (11:35 +0100)]
x86: show page walk also for early page faults

At once, move the common (between 32- and 64-bit) definition of
machine_to_phys_mapping_valid to a common location.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86/DMI: use proper structures instead of byte offsets
Jan Beulich [Thu, 23 Jun 2011 10:34:40 +0000 (11:34 +0100)]
x86/DMI: use proper structures instead of byte offsets

Besides being (in my eyes) desirable cleanup, this at once represents
another prerequisite for native EFI booting support.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: allow Dom0 image to be compressed ELF
Jan Beulich [Thu, 23 Jun 2011 10:33:57 +0000 (11:33 +0100)]
x86: allow Dom0 image to be compressed ELF

Rather than being able to decompress only the payloads of bzImage
containers, extend the logic to also decompress simple compressed ELF
images. At once, allow uncompressed bzImage payloads.

This is a prerequisite for native EFI booting support (where, in the
absence of a capable secondary boot loader, the image will always be
in compressed form).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agoreplace d->nr_pirqs sized arrays with radix tree
Jan Beulich [Thu, 23 Jun 2011 10:32:43 +0000 (11:32 +0100)]
replace d->nr_pirqs sized arrays with radix tree

With this it is questionable whether retaining struct domain's
nr_pirqs is actually necessary - the value now only serves for bounds
checking, and this boundary could easily be nr_irqs.

Note that ia64, the build of which is broken currently anyway, is only
being partially fixed up.

v2: adjustments for split setup/teardown of translation data

v3: re-sync with radix tree implementation changes

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agoSimplify preempt.h dependencies by moving in_atomic() to preempt.c
Keir Fraser [Thu, 23 Jun 2011 10:27:38 +0000 (11:27 +0100)]
Simplify preempt.h dependencies by moving in_atomic() to preempt.c

..clean up the ensuing fallout.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years ago[VTD] print out debug message in vt-d fault handler only when iommu=debug is set
Allen Kay [Thu, 23 Jun 2011 10:11:24 +0000 (11:11 +0100)]
[VTD] print out debug message in vt-d fault handler only when iommu=debug is set

Print out debug messages in vtd_page_fault() handler only when
iommu=debug is set xen boot parameter.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
14 years agolibxl: remove and hgignore testenum.c
Ian Jackson [Wed, 22 Jun 2011 13:43:53 +0000 (14:43 +0100)]
libxl: remove and hgignore testenum.c

This is an output file from the test idl generator and should not have
been committed.

Reported-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoQEMU_TAG update
Ian Jackson [Tue, 21 Jun 2011 17:28:53 +0000 (18:28 +0100)]
QEMU_TAG update

14 years agolibxl: autogenerate to_string and from_string functions for Enumerations.
Ian Campbell [Tue, 21 Jun 2011 17:26:39 +0000 (18:26 +0100)]
libxl: autogenerate to_string and from_string functions for Enumerations.

The generated strings are the lower case enum value names, with underscores.
Accepted string for parsing are the same but are case insensitive.

We provide a table of strings->value for each Enumeration as well as a
convenience function to perform a lookup.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxl: improve compatibility with xm
Carsten Schiers [Tue, 21 Jun 2011 17:24:34 +0000 (18:24 +0100)]
xl: improve compatibility with xm

/etc/init.d/xendomains relies on simple pattern matching from sructures
being printed by "xl list -l" command. so update xl implementation to
match.

Signed-off-by: Carsten Schiers <carsten@schiers.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools/ocaml: ask compiler for correct library
Mike McClurg [Tue, 21 Jun 2011 17:01:51 +0000 (18:01 +0100)]
tools/ocaml: ask compiler for correct library

OCaml libraries will live in /usr/local/ if the user compiles OCaml
from source. This patch asks the OCaml compiler where we should look
for libraries.

NB: it may be that we should do the same thing for the NetBSD case,
but I don't have a BSD box to test this out.

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: add all pci devices to xenstore at once (during VM create)
Marek Marczykowski [Tue, 21 Jun 2011 16:50:47 +0000 (17:50 +0100)]
libxl: add all pci devices to xenstore at once (during VM create)

When adding pci devices one by one, pciback notice only the first one. For
every next, "state" is left as is (usualy "4" in that time), so backend will
not rescan xenstore. So when VM is starting all devices should be added at once
and then backend can initialize it.

This applies only to pci, because only pci backend have one xenstore dir for
multiple devices.

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agomake xendomains service save/migrate vms under /etc/xen/auto only
Zhigang Wang [Tue, 21 Jun 2011 16:48:00 +0000 (17:48 +0100)]
make xendomains service save/migrate vms under /etc/xen/auto only

Currently, xendomains service will save or migrate all the running domains in
the host on stop.

Change XENDOMAINS_AUTO_ONLY=true. Then on service stop, it will only
save or migrate all VMs under XENDOMAINS_AUTO (/etc/xen/auto), but always
shutdown all the running VMs.

It's a way to cleanly shutdown all the running VMs on system reboot. If you
want to save/migrate a VM, create a link to /etc/xen/auto.

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: always set list out parameter of libxl_device_pci_list_assigned
Stefano Stabellini [Tue, 21 Jun 2011 16:35:57 +0000 (17:35 +0100)]
libxl: always set list out parameter of libxl_device_pci_list_assigned

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxenpaging: remove private mem_event.h
Olaf Hering [Fri, 10 Jun 2011 08:47:29 +0000 (10:47 +0200)]
xenpaging: remove private mem_event.h

tools/xenpaging/mem_event.h is only included in xenpaging.h.
Add the contents into that file and remove mem_event.h.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: implement stopping of pager by sending SIGTERM/SIGINT
Olaf Hering [Fri, 10 Jun 2011 08:47:28 +0000 (10:47 +0200)]
xenpaging: implement stopping of pager by sending SIGTERM/SIGINT

Write all paged-out pages back into the guest if the pager is
interrupted by ctrl-c or if it receives SIGTERM.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: add watch thread to catch guest shutdown
Olaf Hering [Fri, 10 Jun 2011 08:47:27 +0000 (10:47 +0200)]
xenpaging: add watch thread to catch guest shutdown

If xenpaging is started manually then no event is sent to xenpaging when
the guest is shutdown or rebooted.  Add a watch on the @releaseDomain
node to leave the loop and gracefully shutdown the pager.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: add helper function for unlinking pagefile
Olaf Hering [Fri, 10 Jun 2011 08:47:25 +0000 (10:47 +0200)]
xenpaging: add helper function for unlinking pagefile

Unlink pagefile in the signal handler and also in the exit path.
This does not leave a stale pagefile if an error occoured.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: pass integer to xenpaging_populate_page
Olaf Hering [Fri, 10 Jun 2011 08:47:24 +0000 (10:47 +0200)]
xenpaging: pass integer to xenpaging_populate_page

Pass gfn as integer to xenpaging_populate_page(). xc_map_foreign_pages()
takes a pointer to a list of gfns, but its a const pointer. So writing
the value back to the caller is not needed.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: start paging in the middle of gfn range
Olaf Hering [Fri, 10 Jun 2011 08:47:23 +0000 (10:47 +0200)]
xenpaging: start paging in the middle of gfn range

Set the starting gfn to somewhere in the middle of the gfn range to
avoid paging during BIOS startup. This can speedup booting of a guest.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: move num_pages into xenpaging struct
Olaf Hering [Fri, 10 Jun 2011 08:47:22 +0000 (10:47 +0200)]
xenpaging: move num_pages into xenpaging struct

Move num_pages into struct xenpaging.
num_pages will be used by the policy in a subsequent patch.

Also remove a memset, the victims array is allocated with calloc.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: remove local domain_id variable
Olaf Hering [Fri, 10 Jun 2011 08:47:20 +0000 (10:47 +0200)]
xenpaging: remove local domain_id variable

Remove the local domain_id variable, it is already fetched from
paging->mem_event in other places.
Update the sprintf format string to use unsigned argument.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: catch xc_mem_paging_resume errors
Olaf Hering [Fri, 10 Jun 2011 08:47:19 +0000 (10:47 +0200)]
xenpaging: catch xc_mem_paging_resume errors

In the unlikely event that xc_mem_paging_resume() fails, do not overwrite the
error with the return value from xc_evtchn_notify()

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: remove return values from functions that can not fail
Olaf Hering [Fri, 10 Jun 2011 08:47:18 +0000 (10:47 +0200)]
xenpaging: remove return values from functions that can not fail

get_request() and put_response() can not fail, remove return value
and update calling functions.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: remove srand call
Olaf Hering [Fri, 10 Jun 2011 08:47:16 +0000 (10:47 +0200)]
xenpaging: remove srand call

The policy uses now a linear algorithm instead of a random one.
Remove the call to srand().

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: do not bounce p2mt back to the hypervisor
Olaf Hering [Wed, 22 Jun 2011 13:47:13 +0000 (14:47 +0100)]
xenpaging: do not bounce p2mt back to the hypervisor

do not bounce p2mt back to the hypervisor because p2m_mem_paging_populate()
and p2m_mem_paging_resume() dont make use of p2mt.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: correct dropping of pages to avoid full ring buffer
Olaf Hering [Fri, 10 Jun 2011 08:47:14 +0000 (10:47 +0200)]
xenpaging: correct dropping of pages to avoid full ring buffer

Doing a one-way channel from Xen to xenpaging is not possible with the
current ring buffer implementation. xenpaging uses the mem_event ring
buffer, which expects request/response pairs to make progress. The
previous patch, which tried to establish a one-way communication from
Xen to xenpaging, stalled the guest once the buffer was filled up with
requests. Correct page-dropping by taking the slow path and let
p2m_mem_paging_resume() consume the response from xenpaging. This makes
room for yet another request/response pair and avoids hanging guests.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: drop xc.c, remove xc files
Olaf Hering [Fri, 10 Jun 2011 08:47:12 +0000 (10:47 +0200)]
xenpaging: drop xc.c, remove xc files

Finally remove xc.c/xc.h and its references since both are empty now.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: drop xc.c, move xc_wait_for_event_or_timeout
Olaf Hering [Fri, 10 Jun 2011 08:47:11 +0000 (10:47 +0200)]
xenpaging: drop xc.c, move xc_wait_for_event_or_timeout

Move xc_wait_for_event_or_timeout() into xenpaging and massage it a bit for
further changes in subsequent patches.
Include poll.h instead of sys/poll.h.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: drop xc.c, move xc_mem_paging_flush_ioemu_cache
Olaf Hering [Fri, 10 Jun 2011 08:47:10 +0000 (10:47 +0200)]
xenpaging: drop xc.c, move xc_mem_paging_flush_ioemu_cache

Move xc_mem_paging_flush_ioemu_cache() into xenpaging and massage it a bit to
use the required members from xenpaging_t.
Also update type of rc to match xs_write() return value.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: drop xc.c, remove xc_wait_for_event
Olaf Hering [Fri, 10 Jun 2011 08:47:08 +0000 (10:47 +0200)]
xenpaging: drop xc.c, remove xc_wait_for_event

xc_wait_for_event is not used in xenpaging.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: drop xc.c, remove xc_platform_info_t
Olaf Hering [Fri, 10 Jun 2011 08:47:07 +0000 (10:47 +0200)]
xenpaging: drop xc.c, remove xc_platform_info_t

xc_platform_info_t is not used in xenpaging.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: drop xc.c, remove ASSERT
Olaf Hering [Fri, 10 Jun 2011 08:47:06 +0000 (10:47 +0200)]
xenpaging: drop xc.c, remove ASSERT

The ASSERT is not needed, victim is never NULL.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: add xs_handle to struct xenpaging
Olaf Hering [Wed, 22 Jun 2011 13:47:09 +0000 (14:47 +0100)]
xenpaging: add xs_handle to struct xenpaging

A xs_handle is currently used in the xc_mem_paging_flush_ioemu_cache()
function and will be used by a subsequent patch.
Add it to struct xenpaging.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 years agotools: merge several bitop functions into xc_bitops.h
Olaf Hering [Fri, 10 Jun 2011 08:47:03 +0000 (10:47 +0200)]
tools: merge several bitop functions into xc_bitops.h

Bitmaps are used in save/restore, xenpaging and blktap2.  Merge the code into a
private xc_bitops.h file. All users are single threaded, so locking is not an
issue. The array of bits is handled as volatile because the x86 save/restore
code passes the bitmap to the hypervisor which in turn modifies the bitmap.

blktap2 uses a private bitmap. There was a possible overflow in the
bitmap_size() function, the remainder was not considered.

ia64 save/restore uses a bitmap to send the number of vcpus to the host.

x86 save/restore uses a bitmap to track dirty pages. This bitmap is shared with
the hypervisor. An unused function count_bits() was removed and a new
bitmap_size() function is now used.

xenpaging uses 3 private bitmaps to track the gfns which are in paged-out
state.  It had a copy of some Linux bitops.h, which is now obsolete. Also the
BITS_PER_LONG macro was hardcoded to 64 which made it impossible to run 32bit
tools on a 64bit host. Wether this works at all has to be tested, yet.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agoxenpaging: remove unused spinlock in pager
Olaf Hering [Fri, 10 Jun 2011 08:47:02 +0000 (10:47 +0200)]
xenpaging: remove unused spinlock in pager

The spinlock code in the pager is a no-op because xenpaging is a single
threaded application. There is no locking when put_response() places a
response into the ringbuffer.
The only locking is inside the hypervisor, where mem_event_put_request() and
mem_event_get_response() lock the ringbuffer to protect multiple vcpus from
each other.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools/blktap2: tapdisk2 executable usage message documents -D option
Philipp Hahn [Tue, 21 Jun 2011 15:51:43 +0000 (16:51 +0100)]
tools/blktap2: tapdisk2 executable usage message documents -D option

Signed-off-by: Philipp Hahn <hahn@univention.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxenctx: add option -C to dump context for all vcpus
Olaf Hering [Fri, 17 Jun 2011 12:22:56 +0000 (14:22 +0200)]
xenctx: add option -C to dump context for all vcpus

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>